# This script installs the source for MacMiNT and the extra tools needed
# to build it.
#
# This script assumes that minimal.sh and normal.sh have been run
# successfully.
#
# The following archives should be in your $SAVE directory:
#
# src.tar.gz
# mac.tar.gz
#
# These files come with the MacMiNT distribution.  You might also be able to
# get more recent versions from a MacMiNT archive.
#
# The other files needed for this installation need to be taken from the MPW
# environment.  These files come with MPW C, they can be ordered separately
# from APDA, and they are ftp-able from ftp.apple.com.  Be sure to read and
# abide by the copyright restrictions on ftp.apple.com.  This script has only
# been tested on the versions on ftp.apple.com.  Please let me know if it does
# not work with other versions of the MPW files.
#
# dts/mac/tools/mpw/3.2.interfaces/cincludes-mpw3-2.hqx
# dts/mac/tools/mpw/3.2.libraries/libraries.hqx
#
# The header files need to be in a sub-directory of your $SAVE directory called
# 'mpw'.  The file 'Interfaces.o' needs to be in your $SAVE directory.
#

# check for everything
for i in src.tar.gz mac.tar.gz mpw/Types.h Interface.o; do
	if [ ! -r $SAVE/$i ] ; then
		echo "can't find $SAVE/$i"
		exit 1
	fi
done

# make sure src and mac don't exist
if [ -r src/jet ] ; then
	echo "this script should only be run when there is nothing in the 'src' directory"
	exit 1
fi
if [ -r mac/lib ] ; then
	echo "this script should only be run when there is nothing in the 'mac' directory"
	exit 1
fi

# src
echo src
gzip -d < $SAVE/src.tar.gz | tar xf -

# mac
echo mac
gzip -d < $SAVE/mac.tar.gz | tar xf -
(cd mac; perl perl/cvthdr 2)
(cd mac; perl perl/cvthdr 4)
(cd mac/s16; make)
(cd mac/s; make)
(cd mac; rm -r s s16)
(cd mac/lib; oconv $SAVE/Interface.o interface.o; \
	$MAR rs libmac.olb interface.o; \
	$MAR rs libmac16.olb interface.o)
